<extend name='Layout/index' />

<block name='breadcrumb'>
	<li>
		<i class="icon-home home-icon"></i>
		<a href="#">首页</a>
	</li>
	<li class="active">用户管理</li>
</block>

<block name='page_header'>
	<h1 style="font-size:14px">
		 用户管理
		<i class="icon-double-angle-right"></i>
		 会员管理
		<i class="icon-double-angle-right"></i>
		 会员添加
	</h1>
</block>

<block name='main_content'>
		<div style="font-size:14px;margin-left:10px;color:red;font-weight:bold;">基本信息</div>
		<div class="row">
			<div class="col-xs-12">
				<form class="form-horizontal" action='<{:U("insert")}>' method='post'>
				  <div class="form-group">
				    <label for="inputEmail3" class="col-sm-2 control-label">姓名</label>
				    <div class="col-sm-3">
				      <input type="text" class="form-control"  name='name'>
				    </div>
				    <label for="inputEmail3" class="col-sm-2 control-label">婚姻状况</label>
				    <div class="col-sm-5">
				      <select name="status">
				      	<option value="0">未婚</option>
				      	<option value="1">离异</option>
				      	<option value="2">丧偶</option>
				      	<option value="" selected>请选择</option>
				      </select>
				    </div>
				  </div>

				  <div class="form-group">
				  	<label for="" class="col-sm-2 control-label">性别</label>
				  	<div class="col-sm-3">
				      <div class="checkbox">
				        <label>
				          <input type="radio" name='sex' value="0">女
				          <input type="radio" name='sex' value="1">男
				        </label>
				      </div>
				    </div>
				   

				    <label for="inputEmail3" class="col-sm-2 control-label">所在地区</label>
				    <div class="col-sm-5">
				      <select id='prov1' name='s_province'></select>
				      <select id='city1' name='s_city'></select>
				      <select id='county1' name='s_county'></select>
				    </div>
				  </div>
				 <div class="form-group">
				  	<label for="" class="col-sm-2 control-label">生日</label>
				     <div class="col-sm-3">
				      <select id='birthYear' name='birthday_year'>
				      	<option value="">请选择</option>
				      	<?php 
				      		for($i=2015;$i>1950;$i--){   ?>
				      			<option value="<?php echo $i ?>"><?php echo $i ?></option>
				      	<?php	}
				      	?>
				      </select>
				      <select id='birthMonth' name='birthday_month'>
				      	<option value="">请选择</option>
				      	<?php
				      		for($j=12;$j>0;$j--){	?>
				      			<option value="<?php echo $j ?>"><?php echo $j ?></option>
				      	<?php }
				      	?>
				      </select>
				      <select id='birthDay' name='birthday_day'>
				      	<option value="">请选择</option>
				      	<?php
				      		for($s=31;$s>0;$s--){  ?>
				      			<option value="<?php echo $s ?>"><?php echo $s ?></option>

				      	<?php	}
				      	?>
				      </select>
				    </div>

				    <label for="inputEmail3" class="col-sm-2 control-label">家乡</label>
				    <div class="col-sm-5">
				      <select id='prov2' name='j_province'></select>
				      <select id='city2' name='j_city'></select>
				      <select id='county2' name='j_county'></select>
				    </div>
				  </div>
				   <div class="form-group">
				    <label for="inputEmail3" class="col-sm-2 control-label">电话</label>
				    <div class="col-sm-3">
				      <input type="text" class="form-control"  name='phone'>
				    </div>

				    <label for="inputEmail3" class="col-sm-2 control-label">月收入</label>
				    <div class="col-sm-5">
				      <select name='money'>
				      	<option value="1">2000以下</option>
				      	<option value="2">2000-4000</option>
				      	<option value="3">4000-6000</option>
				      	<option value="4">6000-8000</option>
				      	<option value="5">8000-10000</option>
				      	<option value="6">10000以上</option>
				      	<option value="" selected>请选择</option>
				      </select>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="inputEmail3" class="col-sm-2 control-label">邮箱</label>
				    <div class="col-sm-3">
				      <input type="text" class="form-control"  name='email'>
				    </div>

				    <label for="inputEmail3" class="col-sm-2 control-label">购房情况</label>
				    <div class="col-sm-5">
				      <select name="house">
				      	<option value="0">以后告诉你</option>
				      	<option value="1">有房（无房贷）</option>
				      	<option value="2">有房（有房贷）</option>
				      	<option value="3">无房</option>
				      	<option value="" selected>请选择</option>
				      </select>
				    </div>
				  </div>
				  <div class="form-group">
				   	<label for="inputEmail3" class="col-sm-2 control-label">身高</label>
				    <div class="col-sm-3">
				      <input type="text" class="form-control"  name='height'>
				    </div>

				    <label for="inputEmail3" class="col-sm-2 control-label">购车情况</label>
				    <div class="col-sm-5">
				      <select name="car">
				      	<option value="0">以后告诉你</option>
				      	<option value="1">有车（无房贷）</option>
				      	<option value="2">有车（有房贷）</option>
				      	<option value="3">无车</option>
				      	<option value="" selected>请选择</option>
				      </select>
				    </div>
				  </div>
				  <div class="form-group">
				   <label for="inputEmail3" class="col-sm-2 control-label">职业</label>
				    <div class="col-sm-3">
				      <input type="text" class="form-control"  name='pakistan'>
				    </div>
				    	

				   	<label for="inputEmail3" class="col-sm-2 control-label">学历</label>
				    <div class="col-sm-5">
				      <select name='edu'>
				      	<option value="1">初中</option>
				      	<option value="2">中专/职高/技校</option>
				      	<option value="3">高中</option>
				      	<option value="4">大专</option>
				      	<option value="5">本科</option>
				      	<option value="6">硕士</option>
				      	<option value="7">博士</option>
				      	<option value="8">博士后</option>
				      	<option value="" selected>请选择</option>
				      </select>
				    </div>
				 
				  </div>
				  </div>
				  <div class="form-group">
				  	<button style="background-color:#b74635;width:75px;height:46px;color:#fff;font-size:20px;border:none;border-radius:15px;margin-left:135px;margin-top:20px">添加</button>
				  </div>
				</form>
			</div>
		</div>

<script>
$(document).ready(function(){
	loadData($("#prov1"));
	loadData($("#prov2"));

	//绑定事件
	$("#prov1,#city1,#prov2,#city2").change(function(){
		var id=$(this).val();
		loadData($(this).next('select'),id);

		
	})

	//ajax 加载数据的方法
	function loadData(s,id){
		if(id === undefined){
			id = 0;
		}

		$.ajax({
		url:"<{:U('Admin/User/deal')}>",
		type:'get',
		data:{id:id},
		dataType:'json',
		success:function(dis){
			s.empty().hide();
			//清空下一个select并隐藏
			if(dis.length > 0){
				s.show();
				$.each(dis,function(index,value){
				$('<option>').html(value.name).val(value.id).appendTo(s);
			})
				s.trigger('change');
			

			}

		}
		})	
	}

	
})
</script>
</block>